<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
	<head>
		<title><s:text name="page.title.prefix" /> <s:property value="#pageTitle" /></title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/style.css" />
		<script>
    	var categoryId = "<s:property value="category.id"/>";
    	function removeCategory(categoryId){
    		location.href="removeCategory.do?category.id="+categoryId;
    	}
    </script>
	</head>
	<body>
		<div>
			<s:iterator value="category.chainNames" status="status">
				<a href="viewCategory.do?category.id=<s:property value="category.chainIds[#status.index]"/>"> <s:property /> </a> -
			</s:iterator>
		</div>
		<div>
			view
			<form action="saveCategory.do" method="post">
				<input type="hidden" name="act" value="update" />
				<ul>
					<input name="category.parent.id" value="<s:property value="category.parent.id"/>" type="hidden" class="input" />
					<li>
						<input name="category.id" value="<s:property value="category.id"/>" type="text" class="input" />
						类别编号(设定为6位,如:CD0001,EF5602,GT7607),如果最后两位为"00",表示其他类别
					</li>
					<li>
						<input name="category.name" value="<s:property value="category.name"/>" type="text" class="input" />
					</li>
				</ul>
				<input type="submit" value="submit">
			</form>

			Children:
			<ul>
				<s:iterator value="children">
					<li>
						<a href="viewCategory.do?category.id=<s:property value="id"/>"> <s:property value="id" /> </a>
						<s:property value="name" />
						<a href="javascript:removeCategory('<s:property value="id"/>')">X</a>
					</li>
				</s:iterator>
			</ul>

			Add new child:
			<form action="saveCategory.do" method="post">
				<input type="hidden" name="act" value="create" />
				<input name="category.parent.id" value="<s:property value="category.id"/>" type="hidden" class="input" />
				<li>
					<input name="category.id" type="text" class="input" />
					类别编号(设定为6位,如:CD0001,EF5602,GT7607),如果最后两位为"00",表示其他类别
				</li>
				<li>
					<input name="category.name" type="text" class="input" />
				</li>
				<input type="submit" value="submit">
			</form>

		</div>

		<jsp:include page="/include/alertErrors.jsp" />
	</body>

</html>